﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UpdateManager.UserControls {
    /// <summary>
    /// ItemTitle.xaml 的交互逻辑
    /// </summary>
    public partial class ItemTitle : UserControl {

        /// <summary>
        /// 软件数量
        /// </summary>
        private int count = 0;

        /// <summary>
        /// 获取或设置软件数量
        /// </summary>
        public int Count {
            get { return count; }
            set {
                count = value;
                this.runCount.Text = count.ToString();
            }
        }

        /// <summary>
        /// 标题类型
        /// </summary>
        private AssemblyType type = AssemblyType.MainSoftware;

        /// <summary>
        /// 获取获设置标题类型
        /// </summary>
        public AssemblyType Type {
            get { return type; }
            set {
                type = value;

                switch (type) {
                    case AssemblyType.MainSoftware:
                        this.runHeader.Text = "推荐安装(";
                        this.runFooter.Text = ")款主程序，建议您立即下载安装或升级。";
                        break;
                    case AssemblyType.Plugin:
                        this.runHeader.Text = "可选插件(";
                        this.runFooter.Text = ")，您可以根据您的需要选择下载安装或升级。";
                        break;
                }
            }
        }

        /// <summary>
        /// 创建一个<see cref="ItemTitle"/>实例
        /// </summary>
        public ItemTitle() {
            InitializeComponent();
        }

        /// <summary>
        /// 创建一个<see cref="ItemTitle"/>实例
        /// </summary>
        public ItemTitle(int count, AssemblyType type) {
            InitializeComponent();

            this.Count = count;
            this.Type = type;
        }
    }
}
